require "rake/testtask"

task :generate do
  sh "ruby", \
     "-I../../engine/language_client_ruby/lib", \
     "../../engine/language_client_ruby/exe/baml-cli", \
     "generate", "--from", "../baml_src"
end

# Default test task that runs all tests
Rake::TestTask.new(:test) do |t|
  t.libs << "../../engine/language_client_ruby/lib"
  t.libs << "baml_client"
  t.test_files = FileList["test_*.rb"]
  t.options = '--verbose'
end

# Task to run specific tests
Rake::TestTask.new(:test_spec) do |t|
  t.libs << "../../engine/language_client_ruby/lib"
  t.libs << "baml_client"
  t.test_files = FileList[ENV['TEST'] || "test_*.rb"]
  t.options = '--verbose'
end

# Add a description for the tasks
desc "Run all tests"
task :test

desc "Run specific tests (use TEST=test_env_vars.rb)"
task :test_specific